package box;
import java.io.*;
public class Box implements Serializable{
    private int width;
    private int height;

    public void setWidth(int w){
        width = w;
    }
    public void setHeight(int h){
        height = h;
    }

    public static void main(String[] args) {
        Box myBox = new Box();
        myBox.setWidth(50);
        myBox.setHeight(20);

        try{
            FileOutputStream fs = new FileOutputStream("foo.ser");
            ObjectOutputStream os = new ObjectOutputStream(fs);
            os.writeObject(myBox);
            os.close();
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
}
class WriteAFile{
    public static void main(String[] args) {
        try{
            FileWriter writer = new FileWriter("Foo.txt");
            writer.write("hello foo");
            writer.close();
        }catch (IOException ex){
            ex.printStackTrace();
        }
        sp();
    }
    static void sp() {
        String toTest = "what is blue + yellow?/green";
        String[] result = toTest.split("/");
        for (String token : result) {
            System.out.println(token);
        }

    }
}
class  ReadAFile{
    public static void main(String[] args) {
        try{
            File myFile = new File("Foo.txt");
            FileReader fileReader = new FileReader(myFile);
            BufferedReader reader = new BufferedReader(fileReader);
            String line = null;
            while((line = reader.readLine()) != null){
                System.out.println(line);
            }
            reader.close();
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
}